<?php
/**
 * Created by PhpStorm.
 * User: Jason
 * Date: 2017/7/27
 * Time: 11:25
 */

namespace Api\Service;


use Think\Page;

class PageService extends Page
{
    protected $p = 'page';
    public $nowPage = 1;
    public function __construct($param, $totalRows, $listRows, $parameter = array())
    {
        parent::__construct( $totalRows, $listRows, $parameter );
        $this->totalRows  = $totalRows; //设置总记录数
        $this->listRows   = $listRows;  //设置每页显示行数
        $this->parameter  = empty($parameter) ? $_REQUEST : $parameter;
        $this->nowPage = empty($param[$this->p]) ? 1 : intval($param[$this->p]);
        $this->firstRow   = $this->listRows * ($this->nowPage - 1);
    }
}